package com.qf.feign;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Map;
import java.util.Set;

/**
 * @author Ypl
 * @version V1.0
 * @Project OctoberAndNovember
 * @Package com.qf.feign
 * @Description:
 * @Date 2022/11/10 11:00
 */
@SuppressWarnings("all")
@FeignClient("sms-platform-cache")
public interface CacheFeign {
    //通配获取key集合
    @GetMapping(value = "/cache/keys/{key}")
    public Set<String> keys(@PathVariable(value = "key")String key);
    /**
     * 通过key获取redis中的数据 返回    map
     */
    @RequestMapping(value = "/cache/hmget/{key}", method = RequestMethod.GET)
    public Map hMGet(@PathVariable("key") String key);

    /**
     * 通过key获取redis中的数据 返回   String
     */
    @RequestMapping(value = "/cache/get/{key}", method = RequestMethod.GET)
    public String get(@PathVariable("key") String key);

    /**
     * 保存key-value到redis的String结构中,传入的value是Object类型
     * @param key
     * @param value
     * @return
     */
    @PostMapping("/cache/save2cache-object")
    public boolean save(@RequestParam String key,@RequestParam Object value);

    @RequestMapping(value = "/cache/hmset/{key}", method = RequestMethod.POST)
    public boolean hMSet(@PathVariable("key") String key, @RequestBody Map map);


    @RequestMapping(value = "/cache/save2cache", method = RequestMethod.POST)
    public boolean set(@RequestParam("key") String key, @RequestParam("value") String value, @RequestParam("expireSecond") Long expireSecond);
}
